package com.stox.client.ui.javafx.chartingy.model.node;

import javafx.scene.shape.Ellipse;

import com.stox.client.ui.javafx.chartingy.model.plot.Data;
import com.stox.client.ui.javafx.core.util.CSS;
import com.stox.client.ui.javafx.core.util.UI;
import com.stox.shared.charting.model.Pnf.Box;
import com.stox.shared.core.model.Bar;
import com.stox.shared.core.model.Scrip;

public class CirclePnfBox extends AbstractPnfBox {

	private final Ellipse ellipse = new Ellipse();

	public CirclePnfBox(final Data<Scrip, Bar> data, final Box box) {
		super(data, box);
		UI.style(this, CSS.circlePnfBox);

		ellipse.strokeWidthProperty().bind(boxRectangle.heightProperty().multiply(padding));
		ellipse.radiusYProperty().bind(boxRectangle.heightProperty().divide(2).multiply(1 - padding));
		ellipse.radiusXProperty().bind(boxRectangle.widthProperty().divide(2).multiply(1 - padding));
		ellipse.centerXProperty().bind(boxRectangle.xProperty().add(boxRectangle.widthProperty().divide(2)));
		ellipse.centerYProperty().bind(boxRectangle.yProperty().add(boxRectangle.heightProperty().divide(2)));

		getChildren().addAll(boxRectangle, ellipse);
	}

}
